/*
 * ODO: Real-Time In-Memory ORM/DBMS Grid software
 * Copyright (c) 2008, Michael Oksenenko
 * All rights reserved.
 */
#ifndef CONSOLE_FACTORY_HPP
#define CONSOLE_FACTORY_HPP

#include "OsConfig.hpp"

#include "OsComponentFactoryIF.hpp"
#include "ConsoleIF.hpp"
#include "ConsoleLinux.hpp"
#include "ConsoleVista.hpp"

#include <memory>

namespace odo {

template<unsigned OS>
class ConsoleFactory : public OsComponentFactoryIF<ConsoleIF> {

public: // iface

	virtual std::auto_ptr<ConsoleIF> getComponent() = 0;

public: // factory

	virtual ~ConsoleFactory() { /* void */ }

};

//============================================================================
#if ODO_OS_LINUX == ODO_CHOSEN_OS
//----------------------------------------------------------------------------
template<>
class ConsoleFactory<ODO_OS_LINUX> : public OsComponentFactoryIF<ConsoleIF> {

public: // iface

	virtual std::auto_ptr<ConsoleIF> getComponent() {
		return std::auto_ptr<ConsoleIF>(new ConsoleLinux());
	}

public: // factory

	virtual ~ConsoleFactory() { /* void */ }
	ConsoleFactory() { /* void */ }

};
//----------------------------------------------------------------------------
#endif /* ODO_OS_LINUX */
//============================================================================
#if ODO_OS_VISTA == ODO_CHOSEN_OS
//----------------------------------------------------------------------------
template<>
class ConsoleFactory<ODO_OS_VISTA> : public OsComponentFactoryIF<ConsoleIF> {

public: // iface

	virtual std::auto_ptr<ConsoleIF> getComponent() {
		return std::auto_ptr<ConsoleIF>(new ConsoleVista());
	}

public: // factory

	virtual ~ConsoleFactory() { /* void */ }
	ConsoleFactory() { /* void */ }

};
//----------------------------------------------------------------------------
#endif /* ODO_OS_VISTA */
//============================================================================

}

#endif /* CONSOLE_FACTORY_HPP */
